https://leetcode-cn.com/leetbook/read/top-interview-questions-easy/xnwzei/
// 题解 ：https://leetcode-cn.com/problems/linked-list-cycle/solution/141-huan-xing-lian-biao-shuang-zhi-zhen-zhao-huan-/
// 快慢指针

var hasCycle = function (head) {
    let p1 = head;
    let p2 = head
    while (p1 && p2 && p2.next) {
        p1 = p1.next
        p2 = p2.next.next
        if (p1 === p2) {
            return true
        }
    }
    return false
};